package com.zff.rental.utils.sql.impl;

import com.zff.rental.utils.sql.Condition;
import com.zff.rental.utils.sql.FromNext;
import com.zff.rental.utils.sql.JoinNext;
import com.zff.rental.utils.sql.WhereNext;

/**
 * @author HCY
 */
class FromNextImpl extends SqlContextHolder implements FromNext {
    public FromNextImpl(SqlContext sqlContext) {
        super(sqlContext);
    }

    @Override
    public String generateSql() {
        return sqlContext.getEndSql().generateSql();
    }

    @Override
    public JoinNext leftJoin(String table, String tableAlias) {
        return sqlContext.getJoin().leftJoin(table, tableAlias);
    }

    @Override
    public JoinNext rightJoin(String table, String tableAlias) {
        return sqlContext.getJoin().rightJoin(table, tableAlias);
    }

    @Override
    public JoinNext innerJoin(String table, String tableAlias) {
        return sqlContext.getJoin().innerJoin(table, tableAlias);
    }

    @Override
    public JoinNext fullJoin(String table, String tableAlias) {
        return sqlContext.getJoin().fullJoin(table, tableAlias);
    }

    @Override
    public <T> WhereNext where(Condition<T> condition) {
        return sqlContext.getWhere().where(condition);
    }

    @SafeVarargs
    @Override
    public final <T> WhereNext where(String where, T... value) {
        return sqlContext.getWhere().where(where, value);
    }
}
